package src.com.atguigu04._throw;

/**
 * ClassName: ThrowTest
 * Package: src.com.atguigu04._throw
 * Description:
 *
 * @Author BuTang
 * @Create 2023/5/4 14:23
 * @Version 1.0
 */
public class ThrowTest {
    public static void main(String[] args) {
        ThrowTest qwe = null;
        try {
            qwe.regist(123);
        }catch (BelowZeroException e){
            e.printStackTrace();
        }
    }
    double lifeVale;

    public void regist(double lifeVale)throws BelowZeroException{
        if (lifeVale >= 0){
            this.lifeVale = lifeVale;
        }else {
            throw new BelowZeroException("数值不可以小于0");
        }
    }

}
